﻿using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Windows.Forms;

namespace TorchlightModOverseer
{
	public class TransparentTextDisplayBase : Panel
	{
		public TransparentTextDisplayBase()
		{

		}

		protected override void InitLayout()
		{
			DoubleBuffered = true;
			base.InitLayout();
		}

		string text;
		[Category("Appearance")]
		public string Message
		{
			get
			{
				return text;
			}
			set
			{
				text = value;
				this.Invalidate();
			}
		}

		protected override void OnPaint(PaintEventArgs e)
		{
			using (var brush = new SolidBrush(ForeColor))
			{
				var graphics = e.Graphics;
				graphics.CompositingQuality = CompositingQuality.HighQuality;
				graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
				graphics.DrawString(text, Font,
					brush, new PointF(0, 0));
			}
		}
	}
}
